1. Field of the Invention
The present invention relates to a method and device for rendering a three-dimensional model in a virtual space, and to a computer readable recording medium on which a rendering program is stored.
2. Description of the Related Art
In recent years, the technology of computer graphics (CG) has rapidly evolved. Most CG techniques under study aim to make a more photo-realistic rendering. These techniques have made it possible to express images in a more photo-realistic manner.
However, while these photo-realistic rendering techniques have been in use, non-photo-realistic rendering, that is, a technique for creating handwriting-looking images by CG is desired.
For example, cell animation requires enormous time to prepare images of characters in various states by means of human hands. However, CG could greatly reduce the time for preparing these images.
Accordingly, an object of the present invention is to provide a rendering method and device for realizing cell-animation-looking colors as an example of non-photo-realistic rendering, and a computer readable recording medium on which a rendering program is stored.
According to a first aspect of the present invention, a rendering method for rendering a three-dimensional model disposed in a virtual space and constituted by a plurality of polygons, comprises:
a first step for calculating, for each of the polygons, a first luminosity distribution of a region where the polygons are plotted in accordance with a luminosity predetermined for each of apexes of the polygons, and
a second step for generating a color distribution in accordance with a second luminosity distribution and colors predetermined for the polygons, the second luminosity distribution where luminosity is divided into levels within a certain range, a representative luminosity being assigned to each of the levels, the first luminosity distribution calculated in the first step being replaced by the representative luminosity assigned to each of levels of luminosity, and for plotting the polygons in the color distribution.
This allows, for example, a color distribution to be generated based on the second luminosity distribution with the number of levels less than that of the first luminosity distribution that is calculated by a technique such as the Gouraud shading, thereby realizing a cell-animation-looking solid shading.
A rendering method according to a second aspect of the present invention comprises:
a first step for selecting, with luminosity being divided into levels within a certain range, luminosity levels one by one from a plurality of luminosity levels (for example, a luminosity range in an embodiment), each level being associated in advance with a reference luminosity, and
a second step for calculating, each time the luminosity level is selected in the first step, luminosity at a position of each pixel inside the polygons in accordance with a luminosity predetermined for each of apexes of the polygons, and for plotting, only when a luminosity at the position of each pixel lies within a range of luminosity corresponding to the selected luminosity level, the pixel with a color in accordance with the reference luminosity corresponding to the selected luminosity level and a color predetermined for the polygons.
Carrying out the first and second step once would cause only part of the polygons to be colored with a color in accordance with the reference luminosity. However, repeating the first and second step for the number of luminosity levels would cause the inside of the polygons to be colored with a color in accordance with the reference luminosity corresponding to each of the plurality of luminosity levels defined in advance. That is, a cell-animation-looking solid shading can be thereby realized.
The second aspect of the present invention can further comprise a third step for calculating, each time the luminosity level is selected in the aforementioned first step, a color in accordance with a reference luminosity corresponding to the selected luminosity level and a color predetermined for the polygons. Furthermore, the aforementioned second step can be a step for calculating a luminosity at a position of each pixel inside the polygons in accordance with a luminosity predetermined for each of apexes of the polygons, and for plotting, only when a luminosity at the position of each pixel lies within a range of luminosity corresponding to the selected luminosity level, the pixel with a color calculated in the aforementioned step 3.
The second aspect of the present invention can further comprise a fourth step for calculating, before the aforementioned first step, a color for each luminosity level in the polygons in accordance with each reference luminosity associated in advance with each of the luminosity levels and a color predetermined for the polygons, and for associating the color to each luminosity level. Furthermore, the aforementioned second step can be a step for plotting the pixel by employing the color associated with the luminosity level selected in the first step as a color in accordance with the reference luminosity corresponding to the selected luminosity level and the color predetermined for the polygons.
In addition, the second aspect of the present invention can further comprise a fifth step for deriving and setting, before the aforementioned first step, a luminosity at each of apexes of the polygons by a light source calculation for the three-dimensional model. This fifth step can be a step for deriving and setting a luminosity at each of apexes of the polygons in accordance with a normal vector of each apex and information regarding light sources. Alternatively, the fifth step can be a step for deriving the luminosity at each of a plurality of apexes of the polygons from the light source calculation to be carried out for a three-dimensional model in consideration of the color predetermined for the polygons.
Furthermore, the aforementioned first step can be a step for selecting luminosity levels one by one from two or three luminosity levels defined in advance. This is because, in the actual cell animation, two or three colors are used for divided shading.
A rendering device according to a third aspect of the present invention for rendering a three-dimensional model disposed in a virtual space and constituted by a plurality of polygons, comprises:
calculating means, for each of the polygons, for calculating a first luminosity distribution of a region where the polygons are plotted in accordance with a luminosity predetermined for each of a plurality of apexes of the polygons, and
plotting means for generating a color distribution in accordance with a second luminosity distribution and colors predetermined for the polygons, the second luminosity distribution where luminosity is divided into levels within a certain range, a representative luminosity is assigned to each of the levels, and the first luminosity distribution calculated by the calculating means is replaced by the representative luminosity assigned to each of levels of luminosity, and for plotting the polygons in the color distribution.
A rendering device according to a fourth aspect of the present invention comprises:
selecting means for selecting, with luminosity being divided into levels within a certain range, luminosity levels one by one from a plurality of luminosity levels, each level being associated in advance with a reference luminosity, and
plotting means for calculating, each time the luminosity level is selected, luminosity at a position of each pixel inside the polygons in accordance with a luminosity predetermined for each of a plurality of apexes of the polygons, and for plotting, only when a luminosity at the position of each pixel lies within a range of luminosity corresponding to the selected luminosity level, the pixel with a color in accordance with the reference luminosity corresponding to the selected luminosity level and a color predetermined for the polygons.
By carrying out each of the steps in the rendering methods according to the first and second aspect of the present invention by a computer, the same effect as is provided by the aforementioned rendering methods can be obtained. Therefore, the processing steps described above can be carried out using hardware such as a computer, thereby facilitating the implementation of the rendering technique according to the present invention using the hardware.
A program according to a fifth aspect of the present invention for rendering a three-dimensional model disposed in a virtual space and constituted by a plurality of polygons is to allow a computer to carry out:
a first step for calculating, for each of the polygons, a first luminosity distribution of a region where the polygons are plotted in accordance with a luminosity predetermined for each of a plurality of apexes of the polygons, and
a second step for generating a color distribution in accordance with a second luminosity distribution and colors predetermined for the polygons, the second luminosity distribution where luminosity is divided into levels within a certain range, a representative luminosity is assigned to each of the levels, and the first luminosity distribution calculated in the first step is replaced by the representative luminosity assigned to each of levels of luminosity, and for plotting the polygons in the color distribution.
Furthermore, a program according to a sixth aspect of the present invention for rendering is to allow a computer to carry out:
a first step for selecting, with luminosity being divided into levels within a certain range, luminosity levels one by one from a plurality of luminosity levels, each level being associated in advance with a reference luminosity, and
a second step for calculating, each time the luminosity level is selected in the first step, luminosity at a position of each pixel inside the polygons in accordance with a luminosity predetermined for each of a plurality of apexes of the polygons, and for plotting, only when: a luminosity at the position of each pixel lies within a range of luminosity corresponding to the selected luminosity level, the pixel with a color in accordance with the reference luminosity corresponding to the selected luminosity level and a color predetermined for the polygons.
The program according to the fifth and sixth aspect of the present invention is stored on a recording medium or in a storing unit, such as, for example, a CD-ROM, a floppy disc, a memory cartridge, a memory, or a hard disc. As such, by allowing a computer to read a program stored on a recording medium or a storing unit, the aforementioned rendering device and a game device, which is to be described below, can be implemented. Moreover, by using a recording medium, the program can be readily distributed or sold as a software product independently of the device. Furthermore, by carrying out the program using hardware such as a computer, the graphics technique according to the present invention can be readily implemented.
In addition, modifications or the like, which have been described with respect to the second aspect of the present invention, can be applied to the program according to the sixth aspect of the present invention.
A game device according to a seventh aspect of the present invention for rendering a three-dimensional model disposed in a virtual space and constituted by a plurality of polygons comprises a computer, and read means for reading, from a computer readable recording medium on which a program to be carried out by the computer, the program. In addition, the program allows the computer to carry out:
a calculating function for calculating, for each of the polygons, a first luminosity distribution of a region where the polygons are plotted in accordance with a luminosity predetermined for each of a plurality of apexes of the polygons, and
a plotting function for generating a color distribution in accordance with a second luminosity distribution and colors predetermined for the polygons, the second luminosity distribution where luminosity is divided into levels within a certain range, a representative luminosity is assigned to each of the levels, and the first luminosity distribution calculated by the calculating function is replaced by the representative luminosity assigned to each of levels of luminosity, and for plotting the polygons in the color distribution.
A game device according to a eighth aspect of the present invention comprises a computer, and reading means for reading, from a computer readable recording medium on which a program to be carried out by the computer, the program. In addition, the program allows the computer to carry out:
a selecting function for selecting, with luminosity being divided into levels within a certain range, luminosity levels one by one from a plurality of luminosity levels, each level being associated in advance with a reference luminosity, and
a plotting function for calculating, each time a luminosity level is selected by the selecting function, luminosity at a position of each pixel inside the polygons in accordance with a luminosity predetermined for each of a plurality of apexes of the polygons, and for plotting, only when a luminosity at the position of each pixel lies within a range of luminosity corresponding to the selected luminosity level, the pixel with a color in accordance with the reference luminosity corresponding to the selected luminosity level and a color predetermined for the polygons.
A game device according to a ninth aspect of the present invention comprises:
a computer,
read means for reading, from a computer readable recording medium on which a program to be carried out by the computer, the program,
calculating means for calculating, for each of the polygons and in accordance with the program read out, a first luminosity distribution of a region where the polygons are plotted in accordance with a luminosity predetermined for each of apexes of the polygons, and
plotting means for generating a color distribution in accordance with a second luminosity distribution and colors predetermined for the polygons, the second luminosity distribution where luminosity is divided into levels within a certain range, a representative luminosity is assigned to each of the levels, and the first luminosity distribution calculated by the calculating means is replaced by the representative luminosity assigned to each of levels of luminosity, and for plotting the polygons in the color distribution.
A game device according to a tenth aspect of the present invention comprises:
a computer,
read means for reading, from a computer readable recording medium on which a program to be carried out by the computer, the program,
selecting means for selecting, with luminosity being divided into levels within a certain range and in accordance with the program read out, luminosity levels one by one from a plurality of luminosity levels, each level being associated in advance with a reference luminosity, and
plotting means for calculating, each time a luminosity level is selected by the selecting function and in accordance with the program read out, luminosity at a position of each pixel inside the polygons in accordance with a luminosity predetermined for each of a plurality of apexes of the polygons, and for plotting, only when a luminosity at the position of each pixel lies within a range of luminosity corresponding to the selected luminosity level, the pixel with a color in accordance with the reference luminosity corresponding to the selected luminosity level and a color predetermined for the polygons.